babl: initialize the bpp of fishes loaded from cache
authorØyvind Kolås <pippin@gimp.org>
Sat, 20 Jan 2018 17:41:12 +0000 (18:41 +0100)
committerØyvind Kolås <pippin@gimp.org>
Sat, 20 Jan 2018 17:44:07 +0000 (18:44 +0100)
The cache loading code manually constructs path fishes, which did not
get their bpp initialized, this resulted in conversions of long runs to
fail, not crash - but stop processing after MAX_BUFFER_SIZE pixels.

babl/babl-cache.c
babl/babl-fish-path.c
babl/babl-internal.h

index 75780b50681a0c95b5b2d986ca1933893ffe10c6..33d030d5372a07982975bab419ea0502caab7ee9 100644 (file)
@@ -289,6 +289,8 @@ void babl_init_db (void)
             babl->fish.source               = from_format;
             babl->fish.destination          = to_format;
             babl->fish_path.conversion_list = babl_list_init_with_size (10);
+            _babl_fish_prepare_bpp (babl);
+            _babl_fish_rig_dispatch (babl);
 
             token2 = strtok_r (&token[1], seps2, &tokp2);
             while( token2 != NULL )
index d387fa89296909fd147a5a6ff41bf0a2839ed24f..54e9ee40a55763e9f59d7cd6b4125ccad35120f7 100644 (file)
@@ -433,8 +433,8 @@ alias_conversion (Babl *babl,
   return 0;
 }
 
-static void
-babl_fish_prepare_bpp (Babl *babl)
+void
+_babl_fish_prepare_bpp (Babl *babl)
 {
    const Babl *babl_source = babl->fish.source;
    const Babl *babl_dest = babl->fish.destination;
@@ -604,7 +604,7 @@ babl_fish_path2 (const Babl *source,
       return NULL;
     }
 
-  babl_fish_prepare_bpp (babl);
+  _babl_fish_prepare_bpp (babl);
   _babl_fish_rig_dispatch (babl);
   /* Since there is not an already registered instance by the required
    * name, inserting newly created class into database.
index 415bc5ed5a3955f813098851efa3ce3fc5aae939..896ae8127c040cd69d085d1e144b00d57ee1f0b0 100644 (file)
@@ -498,5 +498,6 @@ babl_conversion_process (const Babl *babl,
 }
 
 void _babl_fish_rig_dispatch (Babl *babl);
+void _babl_fish_prepare_bpp (Babl *babl);
 
 #endif